<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <script type="application/javascript" src="http://code.jquery.com/jquery-1.10.0.js"></script>
    <meta charset="UTF-8">
    <title>商品页</title>
    <style type="text/css">
        table {border-collapse: collapse; font-size: 14px;
            width: 80%; margin: auto}
        table, th, td {border: 0px solid darkslategray;padding: 10px}
        .btgn{
            font-family: "Microsoft YaHei UI";
            font-size: 16px;
            color: #255e95;
            background-color: #99CCFF;
            text-align: center;
        }

        tr:nth-child(2n){
            background-color: #fffdf5;
        }
        tr:nth-child(2n+1) {
            background-color: #f2fbfb;
        }

    </style>
</head>
<body>
<div style="text-align: center">
    <span class="span" style="color: darkslategray; font-size: 30px" >商品查询</span>
    <div class="form-group">
        <input type="button" onclick="logout()" value="注销" class="btn btn-primary">
    </div>

    <hr/>
    <a  href="add"><input type="submit" value="新增商品"></a>
<div class="panel-body">
   <div class="row">
    <div class="col-sm-8">
        <form class="form-inline" action="/funUser/keywords?search=search" method="GET">
            <div class="form-group m-r-10">
                <input class="form-control" type="text" value="" id="keywords" name="keywords" placeholder="模糊查询" data-parsley-required="true">
                <button type="submit" class="btn btn-sm btn-primary m-r-5 ajax-form-search"><i class="fa fa-search m-r-5"></i>搜索</button>
            </div>
        </form>
    </div>
   </div>
</div>
    <table class="list">
        <tr>
            <th class="btgn">商品编号</th>
            <th class="btgn">商品名称</th>
            <th class="btgn">商品图片</th>
            <th class="btgn">添加时间</th>
            <th class="btgn">修改时间</th>
            <th class="btgn">操作</th>
        </tr>

        <tr th:each="product : ${products}">
            <td th:text="${product.goodsSn}"></td>
            <td th:text="${product.name}"></td>
            <td th:text="${product.picUrl}"></td>
            <td th:text="${#dates.format(product.addTime,'yyyy-MM-dd HH:mm:ss')}"></td>
            <td th:text="${#dates.format(product.updateTime,'yyyy-MM-dd HH:mm:ss')}"></td>
            <!--<td th:text="${#dates.format(user.birthday, 'yyyy-MM-dd')}">1980-02-30</td>-->
            <!--<td th:text="${user.phone}">1</td>-->
<!--
            <td><a th:href="@{'/funUser/edit?id='+${user.id}}"><input type="submit" value="修改用户"></a>
            <a onclick="return confirm('确定删除当前数据?')"  th:href="@{'/funUser/delete/'+${user.id}}"><input type="submit" value="删除用户"></a></td>
-->
        </tr>
    </table>
</div>
</body>


<script  type="text/javascript" >
    function logout() {
        $.ajax({
            type: "Get",
            dataType: "json",
            url: '/admin/auth/logout',
            contentType: "application/json",
            success: function (result) {
                console.log("data is :" + result)
                if (result.statusCode = 200) {
                    alert("注销成功")
                    window.location.href = "../index/index";
                } else {
                    alert("注销失败，请联系管理员")
                }
            }
        });
    }



</script>
</html>